import requests
from Read_conifg import ReadConfig

class Get_Token():
    #获取客户端Token
    def Get_Khd_Token(self,username=ReadConfig().get_account('user_khd'),

                      password=ReadConfig().get_account("pwd_khd"),

                      url=ReadConfig().get_http('url_khd')+"khdLogin/passwordLogin"):

        body={"param":username,"password":password,"platformType":"公众号","openId":"null"}

        res=requests.post(url=url,json=body)

        return res.headers['Token']

    #获取药师端Token
    def Get_Ysd_Token(self,username=ReadConfig().get_account('user_ysd'),

                      password=ReadConfig().get_account("pwd_ysd"),

                      url=ReadConfig().get_http('url_ysd')+"login/pharmacistLogin"):

        body={"loginName":username,"password":password,"openId":"null"}

        res=requests.post(url=url,json=body)

        return res.headers['Token']

# print(Get_Token().Get_Khd_Token())
# print(Get_Token().Get_Ysd_Token())